<template>
	<view class="content">
		<dom-echart :moduleParam="moduleParam1" :optionData="option"  @changeOption="changeOption()" @getClickData="getClickData1"></dom-echart>
		<dom-echart :moduleParam="moduleParam2" :optionData="option1" @changeOption="changeOption1()" @getClickData="getClickData2"></dom-echart>
		<dom-echart :moduleParam="moduleParam3" :optionData="option2" @changeOption="changeOption2()"  @getClickData="getClickData3"></dom-echart>
	</view>
</template>

<script>
	import domEchart from './echarts/echarts.vue'
	export default {
		components:{
			domEchart
		},
		data() {
			return {
				moduleParam1:{
					id:"moId1",
				},
				moduleParam2:{
					id:"moId2",
				},
				moduleParam3:{
					id:"moId3",
				},
				option: {
					title: {
						text: 'ECharts1'
					},
					xAxis: {
						data: ["衬衫1", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
					},
					yAxis: {},
					series: [{
						name: '销量',
						type: 'bar',
						data: [5, 20, 36, 10, 10, 20]
					}]
				},
				option1: {
					title: {
						text: 'ECharts2'
					},
					series: [{
						name: '销量',
						type: 'pie',
						data: [53, 20, 28, 12, 10, 20]
					}]
				},
				option2: {
					title: {
						text: 'ECharts3'
					},
					xAxis: {
						data: ["衬衫1", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
					},
					yAxis: {},
					series: [{
						name: '销量',
						type: 'line',
						data: [53, 20, 28, 12, 10, 20]
					}]
				}
				}
		},
		onLoad() {

		},
		methods: {
			changeOption(){
				const data = this.option.series[0].data
				// 随机更新示例数据
				data.forEach((item, index) => {
					data.splice(index, 1, Math.random() * 40)
				})
			},
			getClickData1(option){
				console.log("点击的值",option)
			},
			getClickData2(option){
				console.log("点击的值",option)
			},
			getClickData3(option){
				console.log("点击的值",option)
			},
			changeOption1(){
				const data = this.option1.series[0].data
				// 随机更新示例数据
				data.forEach((item, index) => {
					data.splice(index, 1, Math.random() * 40)
				})
			},
			changeOption2(){
				const data = this.option2.series[0].data
				// 随机更新示例数据
				data.forEach((item, index) => {
					data.splice(index, 1, Math.random() * 40)
				})
			},
			
		}
	}
</script>

<style>
</style>
